import java.util.Random;
public class Member implements Comparable<Member>
{
	final public static Random	rdm = new Random();
	protected int ID = 0;
	protected String fName = null,
	                 lName = null;
	public Member()
	{set() ;}
    public Member(Member m)
    {
        ID= m.ID;
        fName = new String(m.fName);
	lName = new String(m.lName);
 	
    }
    public void set ()
    {
		ID = rdm.nextInt(990000000)+10000000;
	    fName = Names.firstName[rdm.nextInt(Names.firstName.length)];
	    lName = Names.lastName[rdm.nextInt(Names. lastName.length)];
    }
   public String toString( ) { return toString ( true ); }
   public String toString( boolean lab ) {
	return (lab? "MEM " : "" ) + String.format("%03d-%02d-%04d %12s %-12s", 
		ID/1000000, ID/1000 % 100, ID % 10000, lName, fName);
   }
   
   public String toTableRow() 
   {
	   return toTableRow ( false ); 
   }
   public String toTableRow(boolean partial)
   {
		return  ( ! partial ? "\n    <TR>\n" : "" ) 
        +  String.format(  "\t<TD width=130>%03d-%02d-%04d</TD><TD align=right width=80>%s </TD><TD width=100> %s</TD>", 
				ID/1000000, ID/1000 % 100, ID % 10000, lName, fName)
       + ( !partial ? "\n    </TR>\n" : "");
   }
   public int compareTo(Member m)
    {
	   if(this.ID>m.ID)
	   {
		   return 0;
	   }
	   else
	   {
		   return 1;
	   }
	   
    }
}
